// 元字符 ( [ { \ ^ $ | ) ] } ? * + .
//在匹配模式中遇到元字符必须使用反斜杠进行转义

let pattern1 = /[ac]bt/i;
let pattern2 = /\[bc\]at/i;
let pattern3 = /.at/gi;
let pattern4 = /\.at/gi;

let reg = /cat/g;
console.log(reg);
console.log(new RegExp(reg));
console.log(new RegExp(reg,'i'));
// /cat/g
// /cat/g
// /cat/i